<html>

<head>
	<title>SWFUpload Test</title>
	<script type="text/javascript" src="/scribble/tinymce/jscripts/swfupload/swfupload.js"></script>
	<script>
	window.onload = function() {

		var onDialogStart = function () { } 

		var onDialogComplete = function (n_selected, n_queued, n_total) {
			if (n_queued > 0) {
				swfu.startUpload();
			}
		} 

		var onFileQueued = function (file) { } 
		
		var onUploadStart = function (file) { }; 
	
		var onUploadProgress = function (file, complete, total) { 
			elWrapper = document.getElementById("file");
			elProgress = document.getElementById("file_bar");
			elName = document.getElementById("file_name");
			elName.innerHTML = file.name;
			elProgress.style.width = Math.round((complete / total) * elWrapper.clientWidth) + "px";
		}; 
	
		var onUploadSuccess = function (file, server_data, receivedResponse) { }; 
	
		var onUploadError = function (file, code, message) { 
			alert("Error uploading " + file.name + ": [" + code + "] " + message); 
		}; 

		var onUploadComplete = function (n_selected, n_queued, n_total) {
			if (swfu.getStats().files_queued > 0) {
				swfu.startUpload();
			} else {
				alert("All files uploaded!");
			}
		} 
		
		// Create the SWFUpload Object 
		var swfu = new SWFUpload({ 
			upload_url : "/scribble/tinymce/jscripts/swfupload/upload.cfm", 
			flash_url : "/scribble/tinymce/jscripts/swfupload/swfupload.swf", 
			file_size_limit : "200 MB", 
			file_dialog_start_handler : onDialogStart,
			file_dialog_complete_handler : onDialogComplete,
			file_queued_handler : onFileQueued,
			upload_start_handler : onUploadStart,
			upload_progress_handler : onUploadProgress,
			upload_success_handler : onUploadSuccess,
			upload_error_handler : onUploadError,
			upload_complete_handler : onUploadComplete,
			button_placeholder_id : "swfupload",
			button_image_url : "/scribble/tinymce/jscripts/swfupload/uploadbutton.png",
			button_width : 61,
			button_height : 22 
		});
	};
	</script>
	<style type="text/css">
	.progressbar {
		position:relative;
		width:400px;
		height:20px;
		background-color:#FFFFFF;
		border:1px solid #000000;
		float:right;
	}
	.progressbar .bar {
		position:absolute;
		left:0;
		height:20px;
		width:1px;
		background-color:#AAAAFF;
	}
	.progressbar .name {
		position:absolute;
		left:0;
		height:20px;
		width:400px;
		overflow-x:hidden;
	}
	</style>
</head>

<body>

	<div id="swfupload">SWFUpload is broken</div>
	<div id="file" class="progressbar">
		<div class="bar" id="file_bar"></div>
		<div class="name" id="file_name"></div>
	</div>

</body>

</html>